<!DOCTYPE HTML>
<html>
<head>
<title>新闻管理后台登录</title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<!-- -->

<script src="js/jquery.min.js"></script>
<script>$(document).ready(function(c) {
	$('.alert-close').on('click', function(c){
		$('.message').fadeOut('slow', function(c){
	  		$('.message').remove();
		});
	});	  
});
</script>
</head>
<body>
<!-- contact-form -->	
<div class="message warning">
<div class="inset">
	<div class="login-head">
		<h1>管理员登录</h1>
		 <div class="alert-close"> </div> 			
	</div>
		<div class="form">
			<li>
				<input type="text" class="text username" placeholder="Username"><a href="#" class=" icon user"></a>
			</li>
				
			<li>
				<input type="password" class="userpass" placeholder="Password"> <a href="#" class="icon lock"></a>
			</li>
			
			<div class="submit">
				<input type="submit" onclick="myFunction()" value="Sign in" >
						 
			</div>
				<div class="clear"> </div>
		</div>
		</div>					
	</div>
	</div>
	
	<script type="text/javascript">
		window.history.forward(-1);
		function myFunction(){
			var adminName = $('.username').val();
			var adminPass = $('.userpass').val();
			if(adminPass==='' || adminName===''){
                 alert("请填写账号/密码");
			}
			else{
				var string ="?adminName="+adminName+"&adminPass="+adminPass;
				$.ajax({
					    type: "get",
                        url: "http://127.0.0.1:8080/login/adminLogin"+string,
		                success:function(data){
		                	if(data===1){$(".clear").text("用户名或密码错误");}
		                	else{
		                		window.location.href="../page/index.html";
		                	}
		                },
		                error:function(){}
				});
			}
		}
	</script>
</body>
</html>